<template>
  <div style="min-height: 300px;">
    <el-form ref="stepForm" size="small" label-width="200px">
      <el-form-item :label="item.stepname" prop="title" v-for="item in stepList" :key="item.id">
        <el-input v-model="item.speed" oninput="if(value > 100) value = 100; if(value < 0 || value === '' || value == null) value = 0;"
                  :minlength="1" :maxlength="3"  placeholder="please input schedule (0-100)" >
          <template slot="append">%</template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSaveStep">save</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import request from '@/utils/request'
export default {
  props:{
    wuLiuId : {type : Number, default: 0}
  },
  data() {
    return {
      stepList:[],
    }
  },
  mounted() {
    this.loadLogisticsStep();
  },
  methods: {
    loadLogisticsStep(){
      request({ url: '/emp/orderwuliu/listwuliustep', data: {wuLiuId:this.wuLiuId} }).then( res =>{
        this.stepList = res.data
      })
    },
    onSaveStep(){
      request({
        url: '/emp/orderwuliu/updatewuliustep',
        data: {stepList : this.stepList}
      }).then( res =>{
        this.$message.success(res.msg)
        this.$emit('update:visible', false);  //关闭弹窗
        this.$EventBus.$emit("wuliuedit", {})
      })
    },
  }
}
</script>

<style scoped>

</style>
